package com.example.demo.huawei;

import java.util.Scanner;

/**
 * 小明的幸运数
 */
/*
5
-5
-5 1 6 0 -7

15
0
-1 0 1 2 3 4 5 6 7 8 9 10 11 12 13

 */
public class OD42 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        // 指令个数
        int cmdNum = sc.nextInt();
        if (cmdNum < 1 || cmdNum > 100) {
            System.out.println(12345);
            return;
        }
        // 幸运数
        int luckyNum = sc.nextInt();
        if (luckyNum < -100 || luckyNum > 100) {
            System.out.println(12345);
            return;
        }
        int[] arr = new int[cmdNum];
        for (int i = 0; i < cmdNum; i++) {
            int cmd = sc.nextInt();
            if (cmd < -100 || cmd > 100) {
                System.out.println(12345);
                return;
            }
            arr[i] = cmd;
        }

        int maxLocation = 0;
        int curr = 0;
        for (int i = 0; i < arr.length; i++) {
            if (arr[i] == luckyNum) {
                if (luckyNum < 0) {
                    curr = curr + arr[i] - 1;
                } else if (luckyNum == 0) {
                    curr = curr + arr[i];
                } else {
                    curr = curr + arr[i] + 1;
                }
            } else {
                curr = curr + arr[i];
            }
            maxLocation = Math.max(maxLocation, curr);
        }
        System.out.println(maxLocation);
    }
}
